package service;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dao.UserDao;
import daoImp.UserDaoImp;
import model.User;

public class Admin_ShowAllUserServlet extends HttpServlet {


	private static final long serialVersionUID = -56460242839701269L;


	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
		request.setCharacterEncoding("UTF-8");
		PrintWriter out = response.getWriter();
		this.doPost(request, response);
		out.flush();
		out.close();
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
		request.setCharacterEncoding("UTF-8");
		PrintWriter out = response.getWriter();
		List<User> users=new ArrayList<User>();
		UserDao dao=new UserDaoImp();
		users=dao.list();
		request.setAttribute("list", users);
		request.getRequestDispatcher("/Admin_showAllUsers.jsp").forward(request,response);
		out.flush();
		out.close();
	}

}
